OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2000 Peter Kelly <pmk@post.com> | 2 * Copyright (C) 2000 Peter Kelly <pmk@post.com> |
3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
4 * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
5 * Copyright (C) 2007 Samuel Weinig <sam@webkit.org> | 5 * Copyright (C) 2007 Samuel Weinig <sam@webkit.org> |
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
7 * Copyright (C) 2008 Holger Hans Peter Freyther | 7 * Copyright (C) 2008 Holger Hans Peter Freyther |
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> | 9 * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com> |
10 * | 10 * |
(...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1350 m_context = 0; | 1350 m_context = 0; |
1351 } | 1351 } |
1352 } | 1352 } |
1353 | 1353 |
1354 XMLTreeViewer xmlTreeViewer(document()); | 1354 XMLTreeViewer xmlTreeViewer(document()); |
1355 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlTr
eeViewer.hasNoStyleInformation(); | 1355 bool xmlViewerMode = !m_sawError && !m_sawCSS && !m_sawXSLTransform && xmlTr
eeViewer.hasNoStyleInformation(); |
1356 if (xmlViewerMode) | 1356 if (xmlViewerMode) |
1357 xmlTreeViewer.transformDocumentToTreeView(); | 1357 xmlTreeViewer.transformDocumentToTreeView(); |
1358 | 1358 |
1359 if (m_sawXSLTransform) { | 1359 if (m_sawXSLTransform) { |
1360 void* doc = xmlDocPtrForString(document()->cachedResourceLoader(), m_ori
ginalSourceForTransform.toString(), document()->url().string()); | 1360 xmlDocPtr doc = xmlDocPtrForString(document()->cachedResourceLoader(), m
_originalSourceForTransform.toString(), document()->url().string()); |
1361 document()->setTransformSource(adoptPtr(new TransformSource(doc))); | 1361 document()->setTransformSource(adoptPtr(new TransformSource(doc))); |
1362 | 1362 |
1363 document()->setParsing(false); // Make the document think it's done, so
it will apply XSL stylesheets. | 1363 document()->setParsing(false); // Make the document think it's done, so
it will apply XSL stylesheets. |
1364 document()->styleResolverChanged(RecalcStyleImmediately); | 1364 document()->styleResolverChanged(RecalcStyleImmediately); |
1365 | 1365 |
1366 // styleResolverChanged() call can detach the parser and null out its do
cument. | 1366 // styleResolverChanged() call can detach the parser and null out its do
cument. |
1367 // In that case, we just bail out. | 1367 // In that case, we just bail out. |
1368 if (isDetached()) | 1368 if (isDetached()) |
1369 return; | 1369 return; |
1370 | 1370 |
1371 document()->setParsing(true); | 1371 document()->setParsing(true); |
1372 DocumentParser::stopParsing(); | 1372 DocumentParser::stopParsing(); |
1373 } | 1373 } |
1374 } | 1374 } |
1375 | 1375 |
1376 void* xmlDocPtrForString(CachedResourceLoader* cachedResourceLoader, const Strin
g& source, const String& url) | 1376 xmlDocPtr xmlDocPtrForString(CachedResourceLoader* cachedResourceLoader, const S
tring& source, const String& url) |
1377 { | 1377 { |
1378 if (source.isEmpty()) | 1378 if (source.isEmpty()) |
1379 return 0; | 1379 return 0; |
1380 | 1380 |
1381 // Parse in a single chunk into an xmlDocPtr | 1381 // Parse in a single chunk into an xmlDocPtr |
1382 // FIXME: Hook up error handlers so that a failure to parse the main documen
t results in | 1382 // FIXME: Hook up error handlers so that a failure to parse the main documen
t results in |
1383 // good error messages. | 1383 // good error messages. |
1384 const UChar BOM = 0xFEFF; | 1384 const UChar BOM = 0xFEFF; |
1385 const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&B
OM); | 1385 const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&B
OM); |
1386 | 1386 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 sax.startElementNs = attributesStartElementNsHandler; | 1520 sax.startElementNs = attributesStartElementNsHandler; |
1521 sax.initialized = XML_SAX2_MAGIC; | 1521 sax.initialized = XML_SAX2_MAGIC; |
1522 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); | 1522 RefPtr<XMLParserContext> parser = XMLParserContext::createStringParser(&sax,
&state); |
1523 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; | 1523 String parseString = "<?xml version=\"1.0\"?><attrs " + string + " />"; |
1524 xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.c
haracters()), parseString.length() * sizeof(UChar), 1); | 1524 xmlParseChunk(parser->context(), reinterpret_cast<const char*>(parseString.c
haracters()), parseString.length() * sizeof(UChar), 1); |
1525 attrsOK = state.gotAttributes; | 1525 attrsOK = state.gotAttributes; |
1526 return state.attributes; | 1526 return state.attributes; |
1527 } | 1527 } |
1528 | 1528 |
1529 } | 1529 } |
OLD | NEW |