|
The only thing that jumps out is that you use Current before calling MoveNext the first time - the documentation[^] says you need to call MoveNext before Current.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi Gareth-
Please check this method:
private void ReadXMLData()
{
XmlDocument xDoc=new XmlDocument();
xDoc.LoadXml("<?xml version=\"1.0\" encoding=\"UTF-8\" ?><Order><Items><Item><Code>A123</Code><Quantity>10</Quantity></Item><Item><Code>A456</Code><Quantity>5</Quantity></Item></Items></Order>");
XmlNodeList xNodeList = xDoc.GetElementsByTagName("Item");
for (Int16 iCount = 0; iCount < xNodeList.Count; iCount++)
{
Response.Write(xNodeList[iCount].ChildNodes.Item(0).InnerText+ "<br/>");
Response.Write(xNodeList[iCount].ChildNodes.Item(1).InnerText + "<br/>");
Response.Write("-----<br/>");
}
}
|
|
|
|
|
I've created the following XML Schema (not for production use, but to learn by doing).
Here's what is burning me at the moment:
The xs:element elements that refer to classes or properties are giving me warnings that "Type 'class' is not declared". I'm still learning this stuff, so I'd really appreciate it if someone could take a quick peek at it and advise me of the (probably obvious) problem in the code below.
Thanks,
Will
<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://gantsoftwaresystems.com/classspec.xsd"
elementFormDefault="qualified"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:element name="classDefs">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="classes">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="class" type="class"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="views">
<xs:complexType>
<xs:sequence>
<xs:element name="view" type="class"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="class">
<xs:sequence minOccurs="1" maxOccurs="unbounded">
<xs:element name="property" type="property"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="base" type="xs:string"/>
<xs:attribute name="hasImageUrl" type="xs:boolean"/>
</xs:complexType>
<xs:complexType name="property">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="alsoTriggerPropertyChanged">
<xs:complexType>
<xs:attribute name="propertyName" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
<xs:attribute name="type" type="xs:string"/>
<xs:attribute name="changesImageUrl" type="xs:boolean"/>
<xs:attribute name="imageUrlQStringParamName" type="xs:string"/>
<xs:attribute name="imageUrlOverridePropertyName" type="xs:string"/>
</xs:complexType>
</xs:schema>
|
|
|
|
|
You need to namespace qualify the type references - you declare them in your target namespace, but when you reference them, don't mention that namespace. You can either use explicit namespace references or (and this is easier) use your target namespace as the default namespace for the schema.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
i need some help on xml. i want to send an xml document to an xml web service using get method. but i didn't find any article, helping material. i did not use xml before. please help me.
thanx
amirzada
|
|
|
|
|
|
You want to 'send' an XML payload with a GET…an amusing concept. Look at the verbs we're using SEND, GET - they're not compatible. You want to use a POST method to send an XML document to a server.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thanx for your help but now i get an exception when i try create an xml document it show that the body and html tag is not closed how can i handle can you help me please.
thanx
amirzada
|
|
|
|
|
More detail - where does the HTML come in - that's NOT XML.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a tool called "Flat file to XML converter" to convert the text file information to XML file using the XSD template available. Text file contains employee details. Whenever a name with apostrphe(') comes the tool converts it as ' instead of '. So whenever the XML file is decoded to view, it is showing the name with '. Please help me in this.
To make any changes in the tool is not possible and no XSLT is available for the XML file. Only XSD is there. I need to validate this ' and replace it with ' Is it possible?
Only a change in XSD is allowed. No seperate application/tool to convert the XML is allowed.
Example:-
flat fle contains the name- O'NEIL, JOHN.
XML file after conversion - O 'NEIL, JOHN.
Output needed - O'NEIL, JOHN
|
|
|
|
|
Validation DOES NOT alter the input XML - it just tells you if it meets the Schema or not.
Why does it matter, anyway? Any conforming XML reader will convert the ' entity to an apostrophe when it reads it!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
But whenever a name with apostrophe comes the "flat file to XML" converter convert it to ' So the XML parser can't change it to apostrophe when it process it. What do i do to avoid it?
|
|
|
|
|
The XML parser will interpret the ' as an apostrophe and store it as such internally. The apostrophe is only converted to ' when written to the XML file.
The XML Standard[^] says that the apostrophe may be stored as ' to permit use in attribute values. By always translating an apostrophe to ' you make sure the apostrophe is always in a readable form.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
sorry friend, i meant whenever a name with apostrophe comes the "flat file to XML converter" converts it to &";apos instead of ' (please omit the double quotes). So the XML parser can't parse it to &apos.
|
|
|
|
|
Sounds like either the flat-files coming with entity encoding already done, or the converters doing the encoding twice. You can't fix that once you're in the XML domain - the original text might have been ' !
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Gives error access denied.
if i change MSXML2.serverXMLHTTP.4.0 to MSXML2.serverXMLHTTP then it gives error that soapaction.
here is my code
<%@language=Jscript%>
<%
var objSrvHTTP;
var objXMLSend;
var objXMLReceive;
var line="";
objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0");
objXMLSend = Server.CreateObject("Microsoft.XMLDOM");
objXMLReceive = Server.CreateObject("Microsoft.XMLDOM");
objXMLSend.async = false;
objFS = Server.CreateObject("Scripting.FileSystemObject");
ReadStream = objFS.OpenTextFile (Server.MapPath("BatchInput.xml"),1,false);
//ReadStream = objFS.OpenTextFile (Server.MapPath("Indulis.xml"),1,false);
var l="";
while (!ReadStream.AtEndOfStream) {
l=ReadStream.Readline();
line = line + l;
}
objSrvHTTP.setTimeouts(-1,-1,-1,-1) //This is important
//If this line is not there it will time out
//Before getting error back
objSrvHTTP.open ("POST","http://gems/GeneralLedgerTest/Update.asmx",false);
//objSrvHTTP.open ("POST","http://aura/GeneralLedger67/Update.asmx",false);
//objSrvHTTP.open ("POST","http://localhost/GeneralLedger/Update.asmx",false);
objSrvHTTP.setRequestHeader("Content-Type", "text/xml");
objSrvHTTP.setRequestHeader("SOAPAction","http://gems/Sample");
objSrvHTTP.send (line);
objXMLReceive = objSrvHTTP.responseXML;
Response.ContentType = "text/xml";
Response.Write (objXMLReceive.xml);
%>
my xml file is
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<LoadGLRequest xmlns='http://www.gemsgov.com/Request'>
<GLTransfer xmlns='http://www.gemsgov.com/Request'>
<GLLoadSchema xmlns='http://tempuri.org/GLLoadSchema.xsd'>
<GLBatch ORGANIZATION='001' EXSource='OHR' Sequence='0'>
<BatchHeader BatchDate='091009' AreaCode='' Operator='OHR' Sequence='1'>
<BatchDetails Account='01-00-00-1010-1010-00000
' Amount='-1214762.58' Description='TEST' GLType='PR' Grant='' Project='' ProjectTask='' WorkorderNumber='' WorkCode='' TransactionDate='082109' AltSource='PR' AltDetail='0001' Sequence='2' />
<BatchDetails Account='01-00-00-1310-0000-00072
' Amount='6769.25
' Description='TEST2' TransactionDate='082109' AltSource='PR' AltDetail='0002' Sequence='3' />
</BatchHeader>
</GLBatch>
</GLLoadSchema>
</GLTransfer>
</LoadGLRequest>
</soap:Body>
</soap:Envelope>
Please let e know asap.
Hemaxi
|
|
|
|
|
Dear All,
I have a combination of classic ASP page and asp.net pages in the application. I am getting this error "Microsoft VBScript runtime error '800a01a8' Object required" on a asp page.
The error is coming from this code:
sRawHtml = Request("h_RawHTML")
Set xd = Server.CreateObject("MSXML2.DOMDocument")
Call xd.loadXML(CStr(sEncrypteXML))
set xel = xd.selectSingleNode("//WebSiteInformation")
xel.setAttribute "Site_HTML", CStr(sRawHTML)
Please tell me if I have written something wrong.
Thanks,
SP
|
|
|
|
|
Which line gets the error ? Is the MSXML2.DOMDocument class present ( I think it's part of IE, so it should be, but that seems to me to be what the problem is ).
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi, the error is on the last line (xel.setAttribute "Site_HTML", CStr(sRawHTML)).
this is working for some HTML code passing thru sRawHTML; and not working for some other HTMLs
|
|
|
|
|
And is it possible you could post examples of working and not-working HTML? Or is it secret?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
This one is working properly
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="1" width="600" id="table1">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>10</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
|
|
|
|
|
...basically this one is giving the error...
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="0" width="680" bordercolor="#008080" id="table1" bgcolor="#33CCCC">
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font color="#FFFFFF"> Should extend up to touch bottom of Search Section </font>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font size="4">Template Test</font>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font size="2">980 pixels wide - variable length</font>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="8">
<font color="#FFFFFF">< Should extend left to be flush with margin of banner and
Search Section</font></td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td colspan="8">
<p align="right">
<font color="#FFFFFF">Should extend right to be flush with margin of banner and Search
Section > </font>
</td>
</tr>
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font color="#FFFFFF">v Should extend down to touch top of Footer Section
v</font>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
|
|
|
|
|
This one is not valid XML.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
OK, well, that's easy. xel is sometimes null. I notice you don't write code to check if it is.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi i had been using XercersDomParser for parsing the XML file in C++
I am not familiar with XML. In the follwing XML file
<?xml version="1.0" encoding="UTF-8"?>
<Locomotives>
<Locomotive xmlns="http://localhost:8080/source/schemas/locomotive.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:8080/source/schemas/locomotive.xsd http://localhost:8080/source/schemas/locomotive.xsd">
<LocoId>9001</LocoId>
<LocoRunNumber>UnReg</LocoRunNumber>
<LocomotiveGPSData>
<SampleTime>2008-07-13T13:37:33</SampleTime>
<Latitude>-32.86693333</Latitude>
<Longitude>151.75333333</Longitude>
<Speed>-1</Speed>
<Direction>-1</Direction>
<KmPostPosition>178500</KmPostPosition>
<TrackNumber>85</TrackNumber>
</LocomotiveGPSData>
<Events>
<Alarms>0</Alarms>
<Faults>0</Faults>
</Events>
</Locomotive>
<Locomotive xmlns="http://localhost:8080/source/schemas/locomotive.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:8080/source/schemas/locomotive.xsd http://localhost:8080/source/schemas/locomotive.xsd">
<LocoId>9002</LocoId>
<LocoRunNumber>UnReg</LocoRunNumber>
<LocomotiveGPSData>
<SampleTime>2008-07-13T23:59:56</SampleTime>
<Latitude>-32.61888333</Latitude>
<Longitude>151.14988333</Longitude>
<Speed>-1</Speed>
<Direction>-1</Direction>
<KmPostPosition>239000</KmPostPosition>
<TrackNumber>87</TrackNumber>
</LocomotiveGPSData>
<Events>
<Alarms>0</Alarms>
<Faults>0</Faults>
</Events>
</Locomotives>
Eventhough i can traverse through XML file through
DOMTreeWalker but can't get idea to store Values in a strucured <list>
the structure look like this
typedef struct
{
Loco_Id LocoId ;
string /*DateTime*/ SampleTime ;
float Lattitude;
float Longitude;
float Speed ;
float Direction;
int KmPostPosition;
int TrackNumber;
int Alarms;
int Failures ;
}LocoDetails
Can any one tell how to access the value from the XML file and store to a list
|
|
|
|