Home » U++ Library support » U++ Core » XmlParser patch
XmlParser patch [message #25137] |
Fri, 12 February 2010 10:02  |
|
Hello Mirek,
Can you review and apply this patch?
Content:
Index: uppsrc/Core/XML.cpp
===================================================================
--- uppsrc/Core/XML.cpp (revision 2047)
+++ uppsrc/Core/XML.cpp (working copy)
@@ -504,12 +504,13 @@
return type == XML_TEXT;
}
-String XmlParser::ReadText()
+String XmlParser::ReadText(bool read_next)
{
if(!IsText())
return String();
String h = text;
- Next();
+ if(read_next)
+ Next();
return h;
}
@@ -530,12 +531,13 @@
return type == XML_DECL;
}
-String XmlParser::ReadDecl()
+String XmlParser::ReadDecl(bool read_next)
{
if(!IsDecl())
throw XmlError("Declaration expected");
String h = text;
- Next();
+ if(read_next)
+ Next();
return h;
}
@@ -544,12 +546,13 @@
return type == XML_PI;
}
-String XmlParser::ReadPI()
+String XmlParser::ReadPI(bool read_next)
{
if(!IsPI())
throw XmlError("Processing info expected");
String h = text;
- Next();
+ if(read_next)
+ Next();
return h;
}
@@ -558,12 +561,13 @@
return type == XML_COMMENT;
}
-String XmlParser::ReadComment()
+String XmlParser::ReadComment(bool read_next)
{
if(!IsComment())
throw XmlError("Comment expected");
String h = text;
- Next();
+ if(read_next)
+ Next();
return h;
}
Index: uppsrc/Core/XML.h
===================================================================
--- uppsrc/Core/XML.h (revision 2047)
+++ uppsrc/Core/XML.h (working copy)
@@ -88,17 +88,17 @@
double Double(const char *id, double def = Null) const;
bool IsText();
- String ReadText();
+ String ReadText(bool read_next = true);
String ReadTextE();
bool IsDecl();
- String ReadDecl();
+ String ReadDecl(bool read_next = true);
bool IsPI();
- String ReadPI();
+ String ReadPI(bool read_next = true);
bool IsComment();
- String ReadComment();
+ String ReadComment(bool read_next = true);
void Skip();
void SkipEnd();
Change motivations:
- Exists situations when you need to read tag, pi, declaration or comment without go to the next step!
example:
..........
if((!v_was_read_xml_pi)
&&(v_xml_in.IsPI())
&&(v_xml_in.ReadPI(false).StartsWith("xml version=\"1.0\""))){
String v_pi = v_xml_in.ReadPI();
...............
svn release: 2047
Regards, Ion Lupascu (tojocky)
|
|
|
Goto Forum:
Current Time: Sun May 04 01:22:36 CEST 2025
Total time taken to generate the page: 0.02061 seconds
|