diff options
Diffstat (limited to 'mcs/class/Mono.Xml.Ext')
5 files changed, 296 insertions, 296 deletions
diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/DTMXPathDocumentWriter.cs b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/DTMXPathDocumentWriter.cs index 0dd7c7849ad..75f291803bd 100644 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/DTMXPathDocumentWriter.cs +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath/DTMXPathDocumentWriter.cs @@ -176,8 +176,8 @@ namespace Mono.Xml.XPath if (!nodes [nodeIndex].IsEmptyElement) parentForFirstChild = nodeIndex; -
- state = WriteState.Content;
+ + state = WriteState.Content; writerDepth++; } @@ -304,40 +304,40 @@ namespace Mono.Xml.XPath } return null; } -
- public override void WriteCData (string data)
- {
- AddTextNode (data);
- }
-
- private void AddTextNode (string data)
- {
- switch (state) {
- case WriteState.Element:
- CloseStartElement ();
- break;
- case WriteState.Content:
- break;
- default:
- throw new InvalidOperationException ("Invalid document state for CDATA section: " + state);
- }
-
- // When text after text, just add the value, and return.
- if (nodes [nodeIndex].Depth == writerDepth) {
- switch (nodes [nodeIndex].NodeType) {
- case XPathNodeType.Text:
- case XPathNodeType.SignificantWhitespace:
- nodes [nodeIndex].Value += data;
- if (IsWhitespace (data))
- nodes [nodeIndex].NodeType = XPathNodeType.SignificantWhitespace;
- else
- nodes [nodeIndex].NodeType = XPathNodeType.Text;
- return;
- }
- }
-
- int parent = GetParentIndex ();
- UpdateTreeForAddition ();
+ + public override void WriteCData (string data) + { + AddTextNode (data); + } + + private void AddTextNode (string data) + { + switch (state) { + case WriteState.Element: + CloseStartElement (); + break; + case WriteState.Content: + break; + default: + throw new InvalidOperationException ("Invalid document state for CDATA section: " + state); + } + + // When text after text, just add the value, and return. + if (nodes [nodeIndex].Depth == writerDepth) { + switch (nodes [nodeIndex].NodeType) { + case XPathNodeType.Text: + case XPathNodeType.SignificantWhitespace: + nodes [nodeIndex].Value += data; + if (IsWhitespace (data)) + nodes [nodeIndex].NodeType = XPathNodeType.SignificantWhitespace; + else + nodes [nodeIndex].NodeType = XPathNodeType.Text; + return; + } + } + + int parent = GetParentIndex (); + UpdateTreeForAddition (); AddNode (parent, 0, // attribute @@ -354,29 +354,29 @@ namespace Mono.Xml.XPath 0, // nsIndex 0, // line info 0); - }
-
- private void CheckTopLevelNode ()
- {
- switch (state) {
- case WriteState.Element:
- CloseStartElement ();
- break;
- case WriteState.Content:
- case WriteState.Prolog:
- case WriteState.Start:
- break;
- default:
- throw new InvalidOperationException ("Invalid document state for CDATA section: " + state);
- }
- }
-
- public override void WriteComment (string data)
- {
- CheckTopLevelNode ();
-
- int parent = GetParentIndex ();
- UpdateTreeForAddition ();
+ } + + private void CheckTopLevelNode () + { + switch (state) { + case WriteState.Element: + CloseStartElement (); + break; + case WriteState.Content: + case WriteState.Prolog: + case WriteState.Start: + break; + default: + throw new InvalidOperationException ("Invalid document state for CDATA section: " + state); + } + } + + public override void WriteComment (string data) + { + CheckTopLevelNode (); + + int parent = GetParentIndex (); + UpdateTreeForAddition (); AddNode (parent, 0, // attribute @@ -393,14 +393,14 @@ namespace Mono.Xml.XPath 0, // nsIndex 0, // line info 0); - }
-
- public override void WriteProcessingInstruction (string name, string data)
- {
- CheckTopLevelNode ();
-
- int parent = GetParentIndex ();
- UpdateTreeForAddition ();
+ } + + public override void WriteProcessingInstruction (string name, string data) + { + CheckTopLevelNode (); + + int parent = GetParentIndex (); + UpdateTreeForAddition (); AddNode (parent, 0, // attribute @@ -417,14 +417,14 @@ namespace Mono.Xml.XPath 0, // nsIndex 0, // line info 0); - }
-
- public override void WriteWhitespace (string data)
- {
- CheckTopLevelNode ();
-
- int parent = GetParentIndex ();
- UpdateTreeForAddition ();
+ } + + public override void WriteWhitespace (string data) + { + CheckTopLevelNode (); + + int parent = GetParentIndex (); + UpdateTreeForAddition (); AddNode (parent, 0, // attribute @@ -441,43 +441,43 @@ namespace Mono.Xml.XPath 0, // nsIndex 0, // line info 0); - }
-
- public override void WriteStartDocument ()
- {
- // do nothing
- }
-
- public override void WriteStartDocument (bool standalone)
- {
- // do nothing
- }
-
- public override void WriteEndDocument ()
- {
- // do nothing
- }
-
- public override void WriteStartElement (string prefix, string localName, string ns)
- {
- switch (state) {
- case WriteState.Element:
- CloseStartElement ();
- break;
- case WriteState.Start:
- case WriteState.Prolog:
- case WriteState.Content:
- break;
- default:
- throw new InvalidOperationException ("Invalid document state for writing element: " + state);
- }
-
- int parent = GetParentIndex ();
- UpdateTreeForAddition ();
+ } + + public override void WriteStartDocument () + { + // do nothing + } + + public override void WriteStartDocument (bool standalone) + { + // do nothing + } + + public override void WriteEndDocument () + { + // do nothing + } + + public override void WriteStartElement (string prefix, string localName, string ns) + { + switch (state) { + case WriteState.Element: + CloseStartElement (); + break; + case WriteState.Start: + case WriteState.Prolog: + case WriteState.Content: + break; + default: + throw new InvalidOperationException ("Invalid document state for writing element: " + state); + } + + int parent = GetParentIndex (); + UpdateTreeForAddition (); WriteStartElement (parent, prevSibling, prefix, localName, ns); state = WriteState.Element; - }
+ } private void WriteStartElement (int parent, int previousSibling, string prefix, string localName, string ns) { @@ -511,49 +511,49 @@ namespace Mono.Xml.XPath lastNsInScope = namespaces [lastNsInScope].NextNamespace; } } -
- public override void WriteEndElement ()
- {
- WriteEndElement (false);
- }
-
- public override void WriteFullEndElement ()
- {
- WriteEndElement (true);
- }
-
- private void WriteEndElement (bool full)
- {
- switch (state) {
- case WriteState.Element:
- CloseStartElement ();
- break;
- case WriteState.Content:
- break;
- default:
- throw new InvalidOperationException ("Invalid state for writing EndElement: " + state);
- }
- parentForFirstChild = -1;
- if (nodes [nodeIndex].NodeType == XPathNodeType.Element) {
- if (!full)
- nodes [nodeIndex].IsEmptyElement = true;
- }
-
- writerDepth--;
- }
-
- public override void WriteStartAttribute (string prefix, string localName, string ns)
- {
- if (state != WriteState.Element)
- throw new InvalidOperationException ("Invalid document state for attribute: " + state);
-
- state = WriteState.Attribute;
+ + public override void WriteEndElement () + { + WriteEndElement (false); + } + + public override void WriteFullEndElement () + { + WriteEndElement (true); + } + + private void WriteEndElement (bool full) + { + switch (state) { + case WriteState.Element: + CloseStartElement (); + break; + case WriteState.Content: + break; + default: + throw new InvalidOperationException ("Invalid state for writing EndElement: " + state); + } + parentForFirstChild = -1; + if (nodes [nodeIndex].NodeType == XPathNodeType.Element) { + if (!full) + nodes [nodeIndex].IsEmptyElement = true; + } + + writerDepth--; + } + + public override void WriteStartAttribute (string prefix, string localName, string ns) + { + if (state != WriteState.Element) + throw new InvalidOperationException ("Invalid document state for attribute: " + state); + + state = WriteState.Attribute; if (ns == XmlNamespaces.XMLNS) ProcessNamespace ((prefix == null || prefix == String.Empty) ? "" : localName, String.Empty); // dummy: Value should be completed else ProcessAttribute (prefix, localName, ns, String.Empty); // dummy: Value should be completed - }
-
+ } + private void ProcessNamespace (string prefix, string ns) { nsIndex++; @@ -586,87 +586,87 @@ namespace Mono.Xml.XPath attributes [attributeIndex - 1].NextAttribute = attributeIndex; } - public override void WriteEndAttribute ()
- {
- if (state != WriteState.Attribute)
- throw new InvalidOperationException ();
-
- openNamespace = false;
- state = WriteState.Element;
- }
-
- public override void WriteString (string text)
- {
- if (WriteState == WriteState.Attribute) {
- if (openNamespace)
- namespaces [nsIndex].Namespace += text;
- else
- attributes [attributeIndex].Value += text;
- }
- else
- AddTextNode (text);
- }
-
- // Well, they cannot be supported, but actually used to
- // disable-output-escaping = "true"
- public override void WriteRaw (string data)
- {
- WriteString (data);
- }
- - public override void WriteRaw (char [] data, int start, int len)
- {
- WriteString (new string (data, start, len));
- }
-
- public override void WriteName (string name)
- {
- WriteString (name);
- }
-
- public override void WriteNmToken (string name)
- {
- WriteString (name);
- }
-
- public override void WriteBase64 (byte [] buffer, int index, int count)
- {
- throw new NotSupportedException ();
- } - - public override void WriteBinHex (byte [] buffer, int index, int count)
- {
- throw new NotSupportedException ();
- }
-
- public override void WriteChars (char [] buffer, int index, int count)
- {
- throw new NotSupportedException ();
- }
-
- public override void WriteCharEntity (char c)
- {
- throw new NotSupportedException ();
- }
-
- public override void WriteDocType (string name, string pub, string sys, string intSubset)
- {
- throw new NotSupportedException ();
- }
+ public override void WriteEndAttribute () + { + if (state != WriteState.Attribute) + throw new InvalidOperationException (); + + openNamespace = false; + state = WriteState.Element; + } + + public override void WriteString (string text) + { + if (WriteState == WriteState.Attribute) { + if (openNamespace) + namespaces [nsIndex].Namespace += text; + else + attributes [attributeIndex].Value += text; + } + else + AddTextNode (text); + } + + // Well, they cannot be supported, but actually used to + // disable-output-escaping = "true" + public override void WriteRaw (string data) + { + WriteString (data); + } + + public override void WriteRaw (char [] data, int start, int len) + { + WriteString (new string (data, start, len)); + } + + public override void WriteName (string name) + { + WriteString (name); + } + + public override void WriteNmToken (string name) + { + WriteString (name); + } + + public override void WriteBase64 (byte [] buffer, int index, int count) + { + throw new NotSupportedException (); + } + + public override void WriteBinHex (byte [] buffer, int index, int count) + { + throw new NotSupportedException (); + } + + public override void WriteChars (char [] buffer, int index, int count) + { + throw new NotSupportedException (); + } + + public override void WriteCharEntity (char c) + { + throw new NotSupportedException (); + } + + public override void WriteDocType (string name, string pub, string sys, string intSubset) + { + throw new NotSupportedException (); + } public override void WriteEntityRef (string name) { - throw new NotSupportedException ();
+ throw new NotSupportedException (); + } + + public override void WriteQualifiedName (string localName, string ns) + { + throw new NotSupportedException (); } - public override void WriteQualifiedName (string localName, string ns)
- {
- throw new NotSupportedException ();
- }
-
- public override void WriteSurrogateCharEntity (char high, char low)
- {
- throw new NotSupportedException ();
+ public override void WriteSurrogateCharEntity (char high, char low) + { + throw new NotSupportedException (); } private bool IsWhitespace (string data) @@ -683,7 +683,7 @@ namespace Mono.Xml.XPath } } return true; - }
+ } #endregion } } diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryCompileException.cs b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryCompileException.cs index c0edeb22b80..90f98e892cc 100644 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryCompileException.cs +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryCompileException.cs @@ -8,27 +8,27 @@ // Copyright (C) Tim Coleman, 2003
// Copyright (C) Novell Inc., 2004
//
- -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// +
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
#if NET_2_0
diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryException.cs b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryException.cs index 00e967cc32d..8c0dd144295 100644 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryException.cs +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml.XPath2/XmlQueryException.cs @@ -6,27 +6,27 @@ //
// Copyright (C) Tim Coleman, 2003
//
- -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// +
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
#if NET_2_0
diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlCachingResolver.cs b/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlCachingResolver.cs index 64b904f5cd8..f369a3b9aff 100644 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlCachingResolver.cs +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlCachingResolver.cs @@ -52,14 +52,14 @@ namespace Mono.Xml { if (File.Exists (GetCachedPath (url))) { // The file is in the cache, lets make sure it is up to date - HttpWebRequest hreq = req as HttpWebRequest;
- // MS has a bug in their .net that makes 3xx errors (such as NotModified, 304)
- // throw when this is *TRUE* even though their docs say it will throw when *FALSE*
+ HttpWebRequest hreq = req as HttpWebRequest; + // MS has a bug in their .net that makes 3xx errors (such as NotModified, 304) + // throw when this is *TRUE* even though their docs say it will throw when *FALSE* hreq.AllowAutoRedirect = false; hreq.IfModifiedSince = File.GetLastWriteTime (GetCachedPath (url)); HttpWebResponse hresp = hreq.GetResponse () as HttpWebResponse; - if (hresp.StatusCode != HttpStatusCode.NotModified)
+ if (hresp.StatusCode != HttpStatusCode.NotModified) using (Stream s = hresp.GetResponseStream ()) AddToCache (url, s); @@ -68,7 +68,7 @@ namespace Mono.Xml { } else { // The file has not been cached yet, so lets just get it // and add it there. - using (Stream s = req.GetResponse ().GetResponseStream ())
+ using (Stream s = req.GetResponse ().GetResponseStream ()) AddToCache (url, s); return GetFromCache (url); } diff --git a/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlChar.cs b/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlChar.cs index 252fc1f9885..b3130f3c3d8 100644 --- a/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlChar.cs +++ b/mcs/class/Mono.Xml.Ext/Mono.Xml/XmlChar.cs @@ -1,24 +1,24 @@ - -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// +
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
using System;
namespace System.Xml
@@ -33,7 +33,7 @@ namespace System.Xml /// </remarks>
internal class XmlChar//XmlConstructs
{
- internal static readonly char [] WhitespaceChars = {' ', '\n', '\t', '\r'}; + internal static readonly char [] WhitespaceChars = {' ', '\n', '\t', '\r'};
/** Character flags. */
internal static readonly byte [] CHARS = new byte [1 << 16];
@@ -665,8 +665,8 @@ namespace System.Xml public static bool IsWhitespace (string str)
{
- for (int i = 0; i < str.Length; i++) - if (!IsWhitespace (str [i])) return false; + for (int i = 0; i < str.Length; i++)
+ if (!IsWhitespace (str [i])) return false;
return true;
}
|