|
You need to look up help/documention for DOMDocument. It has a funtion called save that will save your XML. DOMDocument is where you load your XML. Then you use the nodes to manipulate the content. Then you save the DOMDocument.
|
|
|
|
|
Hi all, and thanks a lot for the help so far.
I now read data, delete some data from my XML tree ,and insert some data. Then I save the data to the file I loaded it from. Everything works fine - except for the formatting. I tend to format my XML data C-like, with tabular indents etc. This is kept in the part of the XML tree not modified from C++ - but the data added from C++ is written in one long line like this
<parent><child1>blah<child2>blah
- any way I can ask the XML engine to format things "my way" or a "standard way". By the way, the data not modified from C++ is getting (damn, whats the word...) truncated/fitted/"replace-one-or-more-newlines-with-only-one-newline". But tabs are kept.
Any hints, oh allmighty gurus of knowledge ;o)
Thanks in advance
/Jan
|
|
|
|
|
|
I want some child elements in an element to repeat. But I also don't care what order. I cant use the "all" compositor because the maxOccurance can only be 1. Here's what I have tried but I still don't have the result I want. The way I thought this should work is "line" and "field" should repeat as many times as needed.
<xsd:element name="group">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="name" minOccurs = "1" maxOccurs ="1"/>
<xsd:choice minOccurs = "0" maxOccurs = "unbounded">
<xsd:element ref="line" minOccurs = "0" maxOccurs = "unbounded"/>
<xsd:element ref="field" minOccurs = "0" maxOccurs = "unbounded"/>
</xsd:choice>
<xsd:element ref="TextFieldGroup" minOccurs = "0" maxOccurs = "unbounded"/>
</xsd:sequence>
<xsd:attribute name="groupType" use = "optional"/>
</xsd:complexType>
</xsd:element>
Any ideas on what I can do?
nay
|
|
|
|
|
I'm quite late in the day to XML and have only used XSD schema.
Is there a way to get a typed value from a XML DOM, particularly in the case of a xsd:dateTime type, without explicitly going through the SOM to find the type. I am look for something not too dissimilar to nodeTypedValue for XSD.
Timezoned dates and times are a particulr problem but I've just stumbled on a newsgroup thread that uses XSD but sets the nodeType to the XDR equivilent to make getting and setting values within the DOM easy. I was planning to include the XDR type as a string in the XML, and take the hit of xdr being non-standard or dissappearing.
Al.
Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".
|
|
|
|
|
Hi there, I am very new to the new technologies (.NET and XML etc) because my work as a developer at this company does not allow for further training.....
My question, I work alot with databases (access mostly).... how will XML make my life better? I have read in MSDN about it a bit, but would like to know the exact uses etc, because I am getting confused by what other people tell me.
Thanks
|
|
|
|
|
There was a discussion about this in this earlier thread.
Basically what's nifty about XML is the fact that it is plain text, making it very generic. The basic XML concept is very simple, and it has a great many uses.
|
|
|
|
|
As far as uses go you have to open your mind a little. One that is very attractive to me is being able to integrate data in a more data driven nature. Take a look at the Apache Cocoon framework for a sample of what I mean by this.
To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
|
|
|
|
|
XML is awesome for several reasons.
Number one is that it is standard. This is the prime reason XML should be considered for anything at all.
Next, it is rigid, and fails with a parse error if it is not. This strongly encourages clean files, and helps with performance, among other things.
Another thing is XSL. Any standard XML document could be transformed into any sort of file with this powerful technology. Raw ASCII, HTML, DHTML, perhaps even things like postscript and CSS.
The XmlDOM and XPath. This lets any program work with XML in a standardized way. Most programs I make with Xml support use the Dom extensivly.
|
|
|
|
|
XML, the downside:
-XML is a lot slower when searched, compared with normal database queries.
-XML adds a lot of overhead, means bigger DB
-XML parsers are usually slow
-.NET implementation of XML is REALLY SLOW and requires managed code, which sucks hard
XML, the upside:
-universal
-simple tree structure: even a child can read it
-can be created/edited with NOTEPAD, the best application ever written
////////////////////////////////////////////////////////////////////
// NOW THE UPSIDE THAT YOU WERE ASKING ABOUT
//
// you can put in a single DB cell a complex and dinamic structure!
// That means that the information saved in the DB can have a dinamic structure WITHOUT changing the DB!!
////////////////////////////////////////////////////////////////////
|
|
|
|
|
Miguel Lopes wrote:
-XML adds a lot of overhead, means bigger DB
Have you ever zipped/compressed an XML file?
Man, I grinned from ear to ear when I saw the compression ratio. Zip loves all those repetitive tags.
So for transfer it is not as big a problem as some people make out. Of course when you are working with the XML it has to be unzipped and then the size can be a pain.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
The greatest thing you'll ever learn is just to love, and to be loved in return - Moulin Rouge
Alison Pentland wrote:
I now have an image of you in front of the mirror in the morning, wearing your knickers, socks and shoes trying to decided if they match!
|
|
|
|
|
The problem is when you are working with a speed-demanding DB system, when the client workstations need almost real time feedback from the DB. If i want to conduct a search inside each XML string (if you treat it as a stream) for each row in a DB table, and you also have to unzip it first, the overall system performance is heavly reduced.
For transfers, no problem. I agree with you.
Best Regards
|
|
|
|
|
Hello;
I want to update my XML file by XSXML40. But i have no idea how can i do that. The main problem is, i don't want to save (or write) whole file after update a record.
How can i update a record in XML file (I don't want to use DOM).
Thank you...
Ahmet Orkun GEDiK
|
|
|
|
|
SAX.
Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".
|
|
|
|
|
how do we display the selected value in select box(drop down) in xsl & xml. All the values for drop down are selected thru' xml file.
|
|
|
|
|
Just to be clear: do you want to use XML/XSL to do something to your select boxes in response to a client-side event?
|
|
|
|
|
yes. I want to use XML/XSL for onChange javascript event.
|
|
|
|
|
You don't really need XSL for client-side processing (unless you want a client-side event to write a lot of HTML). XSL is a transformation language, not a programming language. It can be used to write HTML elements, but doesn't respond to them.
Is this for an intranet application, or an internet application? (I.e. can you control which browser your users have?) What exactly should happen in the SELECT element's onChange event?
|
|
|
|
|
Is this for browser-based client side?
If so, why not do the following:
when event happens send x info to the server using XMLHTTP and use the resulting XML to populate the combo using JScript.
XSL doesn't really fit in here.
Cheers,
Simon
"Every good work of software starts by scratching a developer's personal itch.", Eric S. Raymond
|
|
|
|
|
|
|
Has anyone taken the time to create some schemas for validating SQLXML documents? For example, I'd like to be able to validate an updategram before posting it to my server. Also, the cool intellisense features of having an associated schema would be nice...
Sooner or later, I'll probably take the time to hammer one out, myself, but I thought I'd save the time and effort if someone else has already done this...
Surely Microsoft has just such schemas internally, I wonder why they don't release them. (I've asked a couple times and never gotten a response...)
Thanks!
|
|
|
|
|
I thikn I saw something about that in the Extreme XML column on the MSDN site.
Alice thought that running very fast for a long time would get you to somewhere else. " A very slow kind of country!" said the queen. "Now, here , you see, it takes all the running you can do, to keep in the same place".
|
|
|
|
|
OK, I've got my source document, right? And it uses two different namespaces, my custom one and the XHTML one. The contents of it are a mix of XHTML and my own markup. So the header on that looks like this:
<Page xmlns="/PageWriter/TemplateSchema.xsd" xmlns:XHTML="http://www.w3.org/1999/xhtml">
Now, I've got my XSL stylesheet, right? And it's used to take the source document and transform it into pure XHTML. So I've figured out that I need to do this in my header, I think:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:MHC="/PageWriter/TemplateSchema.xsd">
<xsl:output encoding="utf-8"
indent="yes"
doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" />
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
And thereafter all references in my <xsl:...> tags that refer to my own custom elements use the prefix MHC: , like so:
<title>MadHamster Creations - <xsl:value-of select="MHC:Page/MHC:Head/MHC:Title" /></title>
BUT! The problem is now that I have a few weird output issues. The first of all, and this one is really bad because it makes my documents not validate as XHTML, is that my <html> tag now looks like this:
<html xml:lang="en-US" lang="en-US" xmlns:MHC="/PageWriter/TemplateSchema.xsd" xmlns="http://www.w3.org/1999/xhtml">
Not like this, which is how it's supposed to look but doesn't:
<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
The other weird thing occurs only when I call a template from inside my main template, like so:
<xsl:apply-templates select="MHC:Page/MHC:Body" />
The header for the other template is:
<xsl:template match="MHC:Page/MHC:Body" name="ProcessBody">
Inside the main template, everything works fine. But when I call this other template, all of my XHTML elements generated inside that template have this extra attribute in them. The attribute is xmlns="" , which is needless to say redundant, although it doesn't make the document invalid.
Why? How can I stop it?
Anyone who wants more in-depth information can get my source files and a .NET utility to transform them, by e-mailing me. Think of it as an interesting intellectual challenge! Yeah, that's it! A challenge! Come and fix it, smart people.
Well, thanks in advance.
-Domenic Denicola- [CPUA 0x1337]
MadHamster Creations
"I was born human. But this was an accident of fate - a condition merely of time and place. I believe it's something we have the power to change..."
|
|
|
|
|
Heya,
to get rid of the unnecessary XSL/XML info in your ouptut data then put the attribute 'exclude-result-prefixes' in the xsl:stylesheet node, like this:
<xsl:stylesheet
="" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mhc="/PageWriter/TemplateSchema.xsd" exclude-result-prefixes="MHC">
Just space-separate all the namespace prefixes you do not want in the result.
I also set the 'omit-xml-declaration' to "yes" in the xsl:output element to get rid of the XML declaration.
/WW
|
|
|
|